/**
 * 
 */
package cn.netjava.softkid.chapter01;

/**
 * @author softkid
 * @version v1.0.0
 */
public class Manager 
{
	Student[] sArray;
	int num2;
	public void inputInfo()
	{
		System.out.println("please enter the number of student:");
		java.util.Scanner sc = new java.util.Scanner(System.in);
		int num = sc.nextInt();
		sArray = new Student[num];
		for(int i=0;i<num;i++)
		{
			Student stu = new Student();
			System.out.println("please enter  student"+i+"'s id:");
			stu.setId(sc.nextInt());
			System.out.println("please enter  student"+i+"'s name:");
			stu.setName(sc.next());
			System.out.println("please enter  student"+i+"'s age:");
			stu.setAge(sc.nextInt());
			
			sArray[i]=stu;
			num2=i+1;
			if(num2<sArray.length)
				System.out.println("continue to input?Y/N");
			else{
				System.out.println("the array is already full!");
				break;
			}
			if(sc.next().equalsIgnoreCase("N"))
			{
				num2=i;
				break;
			}
		}
	}
	public void outputInfo()
	{
		System.out.println("the follow are the stuents'information:");
		for(int i=0;i<num2;i++)
		{
			System.out.println(sArray[i]);
		}
	}
	
	public static void main(String[] args)
	{
		Manager m = new Manager();
		m.inputInfo();
		m.outputInfo();
	}
}
